package okl.lab.components.interfaces
{
	import flash.utils.Dictionary;
	
	import mx.core.IUIComponent;
	import mx.utils.StringUtil;
	
	/**
	 * Defines interface for spell check component.
	 * <b>Accepts text to spell. Validates user text</b>
	 * 
	 */
	public interface ISpellChecker extends IUIComponent
	{
		/**
		 * Text provided for checking
		 * <p>Please note! It doesn't provides immediate spell checking, call <code>check()</code> 
		 */
		function get text():String;
		
		function set text(value:String):void;
		/**
		 * Suggestions hashmap of misspelled words for make <code>check()</code> working
		 * 
		 *<p> key is misspelled and value is array of suggestions (strings)
		 * </p>
		 */
		function set spellingSuggestions(value:Dictionary):void;
		
		/**
		 *  A user-supplied function to run on each word to determine correct spelling
 		 *  <p>If word is misspelled it myWordCheckFunction returns the collection of suggestions</p>
		 *  <pre> myWordCheckFunction(word:String):Array</pre>
		 *
		 * 	@return array of suggestions.
		 *  @default null  
		 */
		function set wordCheckFunction(value:Function):void;
		
		/**
		 * Do spell check using provided text and <code>wordCheckFunction</code>.
		 * Displays check results (invalidates ui)
		 * 
		 * Event is dispatched after ui invalidation
		 */
		function check():void;
	}
}